<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/common.css">
</head>

<body>
    <div id="app">
        <div class="option">
            <button class="sub">-</button>
            <button class="add">+</button>
        </div>
        <div class="txt">
            1.31省区市新增境外输入12例热
            4.孟晚舟律师指美方证据明显不可靠
            2.女子当街遭前男友驾车碾压
            5.父亲为骗保把智障儿子推下海新
            3.小伙回应网贷去可可西里捡垃圾
            6.亚美尼亚为长期作战做准备
        </div>
    </div>
</body>
<script>
    let sub = document.querySelector('.sub')
    let add = document.querySelector('.add')
    let txt = document.querySelector('.txt')
    sub.onclick = function () {
        //获得TXT的属性值
        let fontSize = parseInt(getComputedStyle(txt, null).fontSize)
        fontSize--
        if (fontSize < 12) {
            alert('字体不能小于12')
            return
        }
        txt.style.fontSize = fontSize + 'px'
    }
    add.onclick = function () {
        //获得TXT的属性值
        let fontSize = parseInt(getComputedStyle(txt, null).fontSize)
        fontSize++
        if (fontSize < 12) {
            alert('字体不能大于50')
            return
        }
        txt.style.fontSize = fontSize + 'px'
    }
</script>

</html>